#pragma once
#include "Utility.h"
#include "vec.h"
#include <vector>

namespace Voxel
{
	typedef std::vector<Vec3i> Vec3is;
	typedef std::vector<Vec3f> Vec3fs;

	namespace Util_w
	{
		void drawBoxWireFrame(Vec3f LeftDown, Vec3f upRight)
		{
			Util::drawBox(LeftDown[0], LeftDown[1], LeftDown[2], upRight[0], upRight[1], upRight[2]);
		}
		void drawBoxSurface(Vec3f LeftDown, Vec3f upRight)
		{
			Util::drawBoxFace(LeftDown[0], LeftDown[1], LeftDown[2], upRight[0], upRight[1], upRight[2]);
		}

		// Voxel conversion
		Vec3f IJK2XYZ(Vec3i &IJK, float &cubeSize){
			Vec3f XYZ;
			for (size_t i = 0; i < 3; i++){
				XYZ[i] = IJK[i]*cubeSize + cubeSize/2.0;
			}
			return XYZ;
		}
		Vec3i XYZ2IJK(Vec3f &XYZ, float &cubeSize)
		{
			Vec3i IJK;
			for (size_t i = 0; i < 3; i++){
				IJK[i] = floor(XYZ[i]/cubeSize);
			}
			return IJK;
		}
	}
}
